<?php
/**
 * #Celebrate Shieh
 *             ,%%%%%%%%,
 *           ,%%/\%%%%/\%%
 *          ,%%%\c "" J/%%%
 * %.       %%%%/ o  o \%%%
 * `%%.     %%%%    _  |%%%
 *  `%%     `%%%%(__Y__)%%'
 *  //       ;%%%%`\-/%%%'
 * ((       /  `%%%%%%%'
 *  \\    .'          |
 *   \\  /       \  | |
 *    \\/         ) | |
 *     \         /_ | |__
 *     (___________))))))) 攻城湿
 *
 *        _       _
 * __   _(_)_   _(_) __ _ _ __
 * \ \ / / \ \ / / |/ _` |'_ \
 *  \ V /| |\ V /| | (_| | | | |
 *   \_/ |_| \_/ |_|\__,_|_| |_|
 */

namespace App\Services;

use App\Libs\Code\ErrorCode;
use App\Libs\Compress\CompressPictures;
use App\Libs\Redis\RedisLibs;
use App\Libs\Storage\StorageFile;
use App\Validator\AdminValidator;
use App\Validator\BlogValidator;

trait Service
{
    /**
     * @return AdminValidator
     */
    public function getAdminValidator() : AdminValidator
    {
        return new AdminValidator();
    }

    /**
     * @return ErrorCode
     */
    public function getErrorCode() : ErrorCode
    {
        return new ErrorCode();
    }

    /**
     * @return RedisLibs
     */
    public function getRedisLibs() : RedisLibs
    {
        return new RedisLibs();
    }

    /**
     * @return BlogValidator
     */
    public function getBlogValidator() : BlogValidator
    {
        return new BlogValidator();
    }

    /**
     * @return CommonService
     */
    public function getCommon() : CommonService
    {
        return new CommonService();
    }

    /**
     * @param null $name
     *
     * @return StorageFile
     */
    public function getStorage( $name = NULL ) : StorageFile
    {
        return new StorageFile($name);
    }

    /**
     * @param string $src
     * @param float  $percent
     *
     * @return CompressPictures
     */
    public function getPictures( string $src, $percent = 0.5 ) : CompressPictures
    {
        return new CompressPictures($src, $percent);
    }

    /**
     * @return ConfigService
     */
    public function getConfig() : ConfigService
    {
        return new ConfigService();
    }
}
